<template>
  <div class="promptBox">
    <div class="tips flex-start">
      <div class="pic">
        <img src="@/assets/prompt.png" alt="" />
      </div>
      <div class="title">是否要禁用该用户?</div>
    </div>
    <div class="reason flex-start">请选择删除原因</div>

    <div class="content">
      <div class="flex-start">
        <div class="exfw">
          <input type="radio" id="exfw" name="drone" value="恶意访问" v-model="checked"/>
          <label for="exfw">恶意访问</label>
        </div>
        <div class="wjbhf">
          <input
            type="radio"
            id="wjbhf"
            name="drone"
            value="上传不合法文件"
            v-model="checked"

          />
          <label for="wjbhf">上传不合法文件</label>
        </div>
      </div>

      <div class="flex-start second">
        <div class="nrbhf">
          <input
            type="radio"
            id="nrbhf"
            name="drone"
            value="聊天内容不合法"
            v-model="checked"

          />
          <label for="nrbhf">聊天内容不合法</label>
        </div>
        <div class="bdly">
          <input
            type="radio"
            id="bdly"
            name="drone"
            value="该账号疑似被病毒利用"
            v-model="checked"

          />
          <label for="bdly">该账号疑似被病毒利用</label>
        </div>
      </div>

      <div class="flex-start second">
        <div class="else">
          <input type="radio" id="else" name="drone" value="其它" v-model="checked"  />
          <label for="else">其它</label>
        </div>
      </div>
    </div>

    <!-- <div class="content">
      <div>
        <div class="exfw">
          <input type="radio" id="huey" name="drone" value="恶意访问" checked />
          <label for="huey">恶意访问</label>
        </div>
        <div class="wjbhf">
          <input
            type="radio"
            id="huey"
            name="drone"
            value="上传不合法文件"
            checked
          />
          <label for="huey">上传不合法文件</label>
        </div>
        <div class="nrbhf">
          <input
            type="radio"
            id="huey"
            name="drone"
            value="聊天内容不合法"
            checked
          />
          <label for="huey">聊天内容不合法</label>
        </div>

        <div class="bdly">
          <input
            type="radio"
            id="huey"
            name="drone"
            value="该账号疑似被病毒利用"
            checked
          />
          <label for="huey">该账号疑似被病毒利用</label>
        </div>
        <div class="else">
          <input type="radio" id="huey" name="drone" value="其它" checked />
          <label for="huey">其它</label>
        </div>
      </div>
    </div> -->
    <div class="btns flex-end">
      <div class="cancel" @click="cancel">取消</div>
      <div class="determine" @click="confirm">确定</div>
    </div>
  </div>
</template>
<script>
export default {
  data () {
    return {
      checked: null

    }
  },
  methods: {
    cancel () {
      this.$emit('cancel')
    },
    confirm () {
      if (this.checked) {
        const phone = sessionStorage.getItem('phone')
        const reason = this.checked
        this.$store.dispatch('userManage/stopUser', { phone, reason }).then(res => {
          if (res.code === 200) {
            this.$message.success(res.message)
            this.$store.dispatch('userManage/getTableData')
          }
        }).catch(err => {
          this.$message({
            type: 'error',
            message: err,
            duration: 1000
          })
        })
        this.$emit('confirm')
        this.checked = ''

        // console.log(this.checked)
      } else {
        this.$message({
          type: 'error',
          message: '请选择禁用原因',
          duration: 1000
        })
      }
    }
  }
}
</script>
<style lang="scss" scoped>
.promptBox {
  line-height: normal;
  width: 410px;
  height: 277px;
  background: #ffffff;
  box-shadow: 0px 2px 8px 0px rgba(24, 33, 56, 0.28);
  border-radius: 8px;
  position: absolute;
  //   overflow: hidden;
    top: -270px;
    left: -195px;

  z-index: 99;
  .tips {
    height: 22px;
    line-height: 22px;
    margin-top: 16px;
    .pic {
      width: 14px;
      height: 14px;
      margin-left: 16px;
      img {
        width: 100%;
        margin-bottom: 4px;
      }
    }
    .title {
      display: inline-block;
      height: 24px;
      margin-left: 8px;
      line-height: 24px;
      font-size: 16px;
      font-weight: 600;
      color: #1b1f35;
    }
  }
  .reason {
    height: 20px;
    padding-left: 40px;
    width: 100%;
    font-size: 14px;
    font-weight: 400;
    color: #c6ccd7;
  }
  .content {
    padding: 0 32px;
    margin-top: 30px;
    .second {
      margin-top: 20px;
    }
    .flex-start {
      height: 22px;
      line-height: 17px;
      // vertical-align: top;
      input {
        vertical-align: top;
        margin-right: 8px;
      }
    }
    .wjbhf {
      margin-left: 66px;
    }
    .bdly {
      margin-left: 20px;
    }
  }

  // .content {
  //   padding: 0 20px;
  //   white-space: normal;
  //   text-align: left;
  //   input {
  //     vertical-align: middle;
  //     line-height: 16px;
  //   }
  //   .exfw {
  //     display: inline-block;
  //     margin-top: 30px;
  //   }
  //   .wjbhf {
  //     display: inline-block;
  //     margin-left: 57px;
  //   }
  //   .nrbhf {
  //     display: inline-block;
  //     margin-top: 20px;
  //   }
  //   .bdly {
  //     display: inline-block;
  //     margin-left: 10px;
  //   }
  //   .else {
  //     margin-top: 20px;
  //   }
  // }

  .btns {
    margin-top: 30px;
    padding-right: 20px;
    .cancel {
      margin-left: 208px;
      width: 66px;
      text-align: center;
      line-height: 32px;
      height: 32px;
      opacity: 1;
      background: #ffffff;
      border: 1px solid #c6ccd7;
      border-radius: 5px;
    }
    .determine {
      margin-left: 8px;
      width: 66px;
      height: 32px;
      opacity: 1;
      background: #304eec;
      border-radius: 4px;
      text-align: center;
      line-height: 32px;
      color: #fff;
    }
  }
  &::after {
    display: inline-block;
    content: "";
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-top: 8px solid #fff;
    position: absolute;
    bottom: -16px;
    right: 16px;
  }
}
</style>
